package com.rjwh.dingdong.client.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.aishua.lib.utils.AsStrUtils;
import com.rjwh.dingdong.client.R;
import com.rjwh.dingdong.client.bean.localbean.FilterItem;
import com.rjwh.dingdong.client.util.ViewHolder;
import com.wby.base.AdapterBase;

public class FlowTagAdapter extends AdapterBase<FilterItem> {

    private Context mContext;
    private LayoutInflater inflater;

    public FlowTagAdapter(Context context) {
        this.mContext = context;
        inflater = LayoutInflater.from(mContext);
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    protected View getExView(int arg0, View arg1, ViewGroup arg2)
            throws Exception {
        if (arg1 == null) {
            arg1 = inflater.inflate(R.layout.tag_view_item, null);
        }

        TextView tagNameTv = ViewHolder.get(arg1, R.id.item_tag_view_name_tv);
        FilterItem filterItem = mList.get(arg0);
        if (filterItem == null) {
            return arg1;
        }
        String name = filterItem.getName();
        if (!AsStrUtils.isEmpty(name)) {
            tagNameTv.setText(name);
        }
        return arg1;
    }

    @Override
    protected void onReachBottom() {

    }
}
